Queries
Queries all have aquery id
which is returned when you read/create a query. You can also find it within a url, i.e. https://dune.com/queries/<query_id>/<visualization_id>
.
Each query comes with fields you can edit such as:
name
: query name textdescription
: query description textquery_sql
: the raw sql textparams
: parameters within the query, using the{{ foo }}
syntax. See the section below for more details.is_private
: boolean for if query is private or not. Private queries cannot be found or queried by others.archived
: boolean for if query is archived or not. Archived queries cannot run or edited by anyone.
Query Parameters
There are four kinds of parameters you can use in a Dune query (these are not API parameters).- number
- text
- date
- enum (called a list in the UI)
datetime
parameter type requires you use the syntax timestamp '{{block_time_start}}'
to cast the parameter to a timestamp.
If you are using bytearrays/binary (0x1234...
), then you will still pass it as text through the API but ensure your SQL text puts the parameter without any quotes around it.
If you’re using the Dune Python SDK, check out the sdk doc page for an example.